package com.ftg.learn.chapter15;

import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.util.Objects;

/**
 * 工厂类
 * <p>
 * 处理类 :
 * 生成person实例
 * <p>
 * 为实例添加初始值 (注解)
 *  javaBean
 * @author kangjx
 * @version 1.0
 * @date 2023/3/21 上午8:58
 */
public class PersonFactory {

    public static Person getInstancePerson() {
        Person p = new Person();

        PersonAnno personAnno = p.getClass().getAnnotation(PersonAnno.class);

        if(Objects.nonNull(personAnno)){
            p.setName(personAnno.name());
            p.setAge(personAnno.age());
        }

        return p;
    }

    public static <T> T getBeans(Class<T> c) {

        return (T)new Object();
    }

}
